﻿using System.IO;
using System.Net;
using System.Text;
using System.Xml;
using System.Configuration;

namespace APIDataManage
{
    public class APIDataFunction : HttpGetBase
    {
        /// <summary>
        /// Your broker ID
        /// </summary>
        public static readonly string refagt= ConfigurationManager.AppSettings["refagt"].ToString().Trim();
        /// <summary>
        /// Language
        /// </summary>
        public static readonly string lg = ConfigurationManager.AppSettings["lg"].ToString().Trim();

        /// <summary>
        /// Characteristics of the boat--5
        /// </summary>
        /// <param name="id_boat">Name of the boat--Yes</param>
        /// <returns></returns>
        public XmlDocument getBoatCharacteristics(string id_boat)
        {
            string url = string.Format("http://api3.sednasystem.com/API/GetCharacteristics2.asp?id_boat={0}&refagt={1}&lg={2}",id_boat, refagt, lg);
            XmlDocument doc = getAPIData(url);
            return doc;
        }
        /// <summary>
        ///  List of all characteristics--6
        /// </summary>
        /// <returns></returns>
        public XmlDocument getAllCharacteristic()
        {
            string url = string.Format("https://api3.sednasystem.com/API/getExtrasCharFleet.asp?refagt={0}&typ={1}&Lg={2}", refagt, "char", lg);
            XmlDocument doc = getAPIData(url);
            return doc;
        }

        /// <summary>
        ///  List of all extras--6
        /// </summary>
        /// <param name="typ">Empty:extras;value"char":characteristics</param>
        /// <returns></returns>
        public XmlDocument getAllExtra()
        {
            string url = string.Format("https://api3.sednasystem.com/API/getExtrasCharFleet.asp?refagt={0}&typ={1}&Lg={2}", refagt, "", lg);
            XmlDocument doc = getAPIData(url);
            return doc;
        }
        /// <summary>
        /// get Destinations,Countries,Bases--7
        /// </summary>
        /// <param name="type_search">bbcw for bareboat or crewed ;cabin for cabins--No</param>
        /// <param name="srh_ope">List of Ids of the fleet to search--No</param>
        /// <returns></returns>
        public XmlDocument getDestinationsCountriesBases(string type_search, string srh_ope)
        {
            string url = string.Format("http://api3.sednasystem.com/API/GetDestinations3.asp?lg={0}&refagt={1}&type_search={2}&srh_ope={3}", lg, refagt, type_search, srh_ope);
            XmlDocument doc = getAPIData(url);
            return doc;
        }
        /// <summary>
        /// Extras of the boat--8
        /// </summary>
        /// <param name="id_boat">Name of the boat--Yes</param>
        /// <returns></returns>
        public XmlDocument getBoatExtras(string id_boat)
        {
            string url = string.Format("http://api3.sednasystem.com/API/getExtras3.asp?id_boat={0}&refagt={1}", id_boat,refagt);
            XmlDocument doc = getAPIData(url);
            return doc;
        }

        /// <summary>
        /// get all languages--10
        /// </summary>
        /// <returns></returns>
        public XmlDocument getLanguages()
        {
            string url = string.Format("http://api3.sednasystem.com/API/GetLanguages.asp?refagt={0}", refagt);
            XmlDocument doc = getAPIData(url);
            return doc;
        }
        /// <summary>
        /// List of the fleet operators--9
        /// </summary>
        /// <param name="id_ope">Operator ID--No</param>
        /// <returns></returns>
        public XmlDocument getFleetOperators(string id_ope)
        {
            string url = string.Format("http://api3.sednasystem.com/API/getOperators.asp?refagt={0}&id_ope={1}", refagt, id_ope);
            XmlDocument doc = getAPIData(url);
            return doc;
        }
        /// <summary>
        /// List of the boats--11
        /// </summary>
        /// <param name="token">Token--Yes</param>
        /// <param name="appname">Name of the app.The value to use:"apiboatcharter"--Yes</param>
        /// <param name="id_ope">id of the fleet</param>
        /// <param name="id_counrty">Sedna Id of the country--No</param>
        /// <param name="datemaj">Display only the boat updated after the date "datemaj"--No</param>
        /// <param name="id_boat">Sedna id_boat of the boat--No</param>
        /// <param name="date_price">Date to get the price from the past.By default,it's the current date.--No</param>
        /// <returns></returns>
        public XmlDocument getBoats(string token, string appname, string id_ope, string id_counrty, string datemaj, string id_boat, string date_price)
        {
            string url = string.Format("http://api3.sednasystem.com/API/getBts5.asp?token={0}&appname={1}&id_ope={2}&lg={3}&id_country={4}&datemaj={5}&id_boat={6}&date_price={7}", token, appname, id_ope, lg, id_counrty, datemaj, id_boat, date_price);
            XmlDocument doc = getAPIData(url);
            return doc;
        }
        /// <summary>
        /// List of the models--12
        /// </summary>
        /// <returns></returns>
        public XmlDocument getModels()
        {
            string url = string.Format("http://api3.sednasystem.com/API/GetBt_model.asp?refagt={0}", refagt);
            XmlDocument doc = getAPIData(url);
            return doc;
        }
        /// <summary>
        /// List of the special offers--13
        /// </summary>
        /// <returns></returns>
        public XmlDocument getSpecialOffers()
        {
            string url = string.Format("http://api3.sednasystem.com/API/getSpecialOffers2.asp?refagt={0}", refagt);
            XmlDocument doc = getAPIData(url);
            return doc;
        }
        /// <summary>
        /// List of the types--14
        /// </summary>
        /// <returns></returns>
        public XmlDocument getTypes()
        {
            string url = string.Format("http://api3.sednasystem.com/API/GetBt_type.asp?refagt={0}", refagt);
            XmlDocument doc = getAPIData(url);
            return doc;
        }

    }
}
